<template>
    <!--建档资料维护模块 投保内容页面-->
    <div class="baseInfoPage">
        <!-- 投资型商品（投保内容） -->
             <el-tabs v-model="activeTab" type="border-card">
                <el-tab-pane label="投保内容" name="first">
                    <div class="mt20">
                        <el-row> 
                            <el-col :span="24" class="pb15">
                                <el-button @click="copyEuab" :disabled="flag =='N'"  class="mr5" type="danger" plain>复制</el-button>
                                <el-button @click="addEuab"  :disabled="flag =='N'" type="danger" plain>新增</el-button>
                            </el-col>
                        </el-row>                   
                        <div class="table_container">
                            <el-table
                            refs="euabs"
                            :data="euabs"
                            :summary-method="getSummaries"
                            show-summary
                            highlight-current-row
                            @row-click="euabRowClick"
                            header-cell-class-name="table-header-class"
                            style="width:100%">
                            <el-table-column
                                width="80"
                                property="statFund"
                                label=""
                                align='center'>
                                <template slot-scope="scope">
                                    <div v-if="scope.row.statFund=='M'">
                                        <el-input disabled value="主约"></el-input>
                                    </div>
                                    <div v-else>
                                        <el-input disabled value="附约"></el-input>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                min-width="200"
                                property="asName"
                                label="姓名"
                                align='center'>
                                    <template slot-scope="scope">
                                        <el-row>
                                            <el-col :span="15">
                                                <el-input disabled v-model="scope.row.asName"/>
                                            </el-col>
                                            <el-col :span="9" v-if="scope.row.statFund!='M'" style="padding-left:5px!important;">
                                                <el-button :disabled="flag =='N'" type="primary" plain @click="euabChoiceClick(scope.$index,scope.row)">选择</el-button>
                                            </el-col>
                                        </el-row>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    width="80"
                                    property="asAge"
                                    label="年龄"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input disabled v-model="scope.row.asAge"></el-input>
                                        </template>
                                </el-table-column>
                                <el-table-column
                                    property="mortcls"
                                    label="职级"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input disabled v-model="scope.row.mortcls"></el-input>
                                        </template>
                                </el-table-column>
                                <el-table-column
                                    property="channel"
                                    label="性别"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-select v-model="scope.row.asSex" disabled >
                                                <el-option
                                                v-for="item in sexs"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </template>
                                </el-table-column>
                                <el-table-column
                                   min-width="220"
                                    property="polpln"
                                    label="险种"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-row>
                                                <el-col :span="17">
                                                    <el-input :title="scope.row.title" @change="checkPolplnInvest(scope.$index,scope.row)" 
                                                       :disabled="flag =='N'"  v-model="scope.row.polpln"/>
                                                </el-col>
                                                <el-col :span="7" style="padding-left:5px!important;">
                                                    <el-button :disabled="flag =='N'" type="primary" plain @click="xzClick(scope.$index,scope.row)">选择</el-button>
                                                </el-col>
                                            </el-row>
                                        </template>
                                </el-table-column>
                                <el-table-column
                                    width="230"
                                    property="sumins"
                                    label="保额(元)"
                                    align='center'>
                                    <template slot-scope="scope">
                                        <el-row> 
                                            <el-col :span="15" >
                                                <el-input-number v-model="scope.row.sumins"
                                                    style="margin-right:2px!important;" :min="0"
                                                    :max="9999999999" @change="checkSumins(scope.row)"
                                                    :disabled="scope.row.suminsReadonly || flag =='N'"
                                                    :precision="2" :step="1" controls-position="right" />
                                            </el-col>
                                            <el-col :span="9">
                                                <el-select v-model="scope.row.crunit"  :disabled="flag =='N'" placeholder="请选择" >
                                                    <el-option
                                                        v-for="item in crunit"
                                                        :key="item.value"
                                                        :label="item.label"
                                                        :value="item.value">
                                                    </el-option>
                                                </el-select>
                                            </el-col>
                                        </el-row> 
                                    </template>
                                </el-table-column>  
                                <el-table-column
                                    width="150"
                                    property="zbinstprem"
                                    label="每期基本保费"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input-number v-model="scope.row.zbinstprem" :min="0"
                                                :max="999999999999.99" @change="checkZbinstprem(scope.row)"
                                                :disabled="scope.row.zbinstpremReadonly || flag == 'N'"
                                                :precision="2" :step="0.1" controls-position="right" />
                                        </template>   
                                </el-table-column> 
                                <el-table-column
                                    width="150"
                                    property="zlinstprem"
                                    label="每期次标保费"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input-number v-model="scope.row.zlinstprem" :min="0"
                                                disabled
                                                :precision="2" :step="0.1" controls-position="right" />
                                        </template>
                                </el-table-column> 
                                <el-table-column
                                    property="paymentPeriod"
                                    label="操作"
									disabled="flag =='N'"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <span class="operationIcon" disabled="flag =='N'" @click="removeEuab(scope.$index,scope.row)" >
                                                <!-- 删除操作 -->
                                                <el-tooltip :disabled="flag =='N'" class="item" effect="light" content="删除" placement="top">
                                                    <i class="el-icon-delete"></i>
                                                </el-tooltip>
                                            </span>
                                        </template>
                                </el-table-column>
                            </el-table>                                
                        </div>  

                        <el-form>
                            <el-row class="premium mt20 inputColorRed">
                                <el-col :span="7">
                                    <el-form-item label="首期总保费" prop="firstpremTotal" label-width="120px">
                                        <el-input-number disabled class="textColorRed" v-model="euaa.firstpremTotal" 
                                            :precision="2" :step="0.1" controls-position="right">
                                        </el-input-number>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="7">
                                    <el-form-item label="客户填写保费" prop="instPrem02" label-width="120px">
                                        <el-input-number class="textColorRed" v-model="euaa.instPrem02" 
                                            :precision="2" :step="0.1" :disabled="flag =='N'" controls-position="right">
                                        </el-input-number>
                                    </el-form-item>
                                </el-col>
                            </el-row>  
                        </el-form> 

                        <el-form :rules="rules" label-width="130px" class="search_container">
                            <el-row>
                                <el-col :span="8" class="common-box">
                                    <el-col :span="10" class="common-lab">
                                        <label class="labelName">投保书首期应缴保险费合计</label>
                                    </el-col>
                                    <el-col :span="14">
                                         <el-input-number v-model="plybnfts.trnamt01"
                                            :precision="2" :step="0.1" :min="0" :disabled="flag =='N'" controls-position="right" />
                                    </el-col>
                                </el-col>
                                <el-col :span="8" class="common-box">
                                    <el-col :span="10" class="common-lab">
                                        <label class="labelName">缴别</label>
                                    </el-col>
                                    <el-col :span="14">
                                        <el-select v-model="euaa.billfreq" :disabled="flag =='N'" @change="billfreqChange" >
                                            <el-option
                                                v-for="item in billfreq"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-col>
                                </el-col>
                                <el-col :span="8" class="common-box">
                                    <el-col :span="10" class="common-lab">
                                        <label class="labelName">续期缴费方式</label>
                                    </el-col>
                                    <el-col :span="14">
                                        <el-select v-model="euaa.billchnl"  :disabled="flag =='N'" @change="changeBillchnl" >
                                            <el-option
                                                v-for="item in billchnl"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-col>
                                </el-col>
                                <el-col :span="8" class="common-box">
                                    <el-col :span="10" class="common-lab">
                                        <label class="labelName">计费日</label>
                                    </el-col>
                                    <el-col :span="14">
                                        <!--
                                        <el-date-picker
                                        v-model="euaa.caldate"
                                        type="date"
                                        placeholder="选择日期">
                                        </el-date-picker>-->
                                        <el-input v-model="euaa.caldate" ref="caldate" @blur="checkEuaapkyCaldate" :disabled="flag =='N'||euaa.riskType=='转投保'||euaa.riskType=='续保'"></el-input>
                                    </el-col>
                                </el-col>
                                <!-- <el-col :span="8" class="common-box" v-if="euaa.riskType!='转投保'&&euaa.riskType!='续保'">
                                    <el-col :span="10" class="common-lab">
                                        <label class="labelName">短期是否续保</label>
                                    </el-col>
                                    <el-col :span="14">
                                        <div v-if="euabs[0] != undefined">
                                            <el-select v-model="euabs[0].uwind" :disabled="flag =='N'"  placeholder="请选择" >
                                                <el-option
                                                    v-for="item in uwind"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </div>
                                        <div v-else>
                                            <el-select placeholder="请选择" :disabled="flag =='N'" >
                                                <el-option
                                                    v-for="item in uwind"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </div>
                                    </el-col>
                                </el-col> -->
                                <el-col :span="8" class="common-box">
                                    <el-col :span="10" class="common-lab">
                                        <label class="labelName">首次交易时间</label>
                                    </el-col>
                                    <el-col :span="14">
                                        <el-select v-model="euaa.flag15"  :disabled="flag =='N'" placeholder="请选择" >
                                            <el-option
                                                v-for="item in flag15s"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-col>
                                </el-col>
                                <el-col :span="8" class="common-box">
                                    <el-col :span="10" class="common-lab">
                                        <label class="labelName">续期缴费日</label>
                                    </el-col>
                                    <el-col :span="14">
                                        <!--<el-date-picker
                                            v-model="euaa.nextbdate"
                                            type="date"
                                            value-format="yyyy-MM-dd">
                                        </el-date-picker>-->
                                        <el-input v-model="euaa.nextbdate" disabled></el-input>
                                    </el-col>
                                </el-col>
								<el-col :span="8" v-if="insureDataForm.isContainRate =='1'">
								    <el-col :span="10" class="common-lab">
								         <label class="labelName">被保人费率档次</label>
								    </el-col>
								    <el-col :span="14">
								        <el-select :disabled="flag =='N'" v-model="flag03" 
										 @change="changeRate" >
											<el-option
											    v-for="item in flag03s"
											    :key="item.value"
											    :label="item.label"
											    :value="item.value">
											</el-option>
										</el-select>
								    </el-col>
								</el-col>
                        </el-row>
                        </el-form>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="基金选择" name="second">
                    <div class="table_container mt20">
                        <el-table
                            :data="euais"
                            highlight-current-row
                            header-cell-class-name="table-header-class"
							show-summary
							sum-text="组合计"
                            style="width:100%">
                            <el-table-column
                                property="life"
                                label="LIFE"
                                align='center'>
                                    <template slot-scope="scope">
                                        <el-input disabled v-model="scope.row.life"></el-input>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    width="220"
                                    property="crtable"
                                    label="险种"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input disabled v-model="scope.row.crtable"></el-input>
                                        </template>
                                </el-table-column>
                                <el-table-column
                                    width="220"
                                    property="fcode"
                                    label=""
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input disabled v-model="scope.row.fcode"></el-input>
                                        </template>
                                </el-table-column>
                                <el-table-column
                                    property="hfnddesc"
                                    label="投资账户名称"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input disabled v-model="scope.row.hfnddesc"></el-input>
                                        </template>
                                </el-table-column>
                                <el-table-column
                                    property="unitAllocPercAmt"
                                    label="比率"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input  :disabled="flag =='N'" v-model="scope.row.unitAllocPercAmt" @blur="checkUnitAllocPercAmt" maxlength="6"></el-input>
                                        </template>
                                </el-table-column>
                                
                        </el-table>                                
                    </div>  
                </el-tab-pane>
                <el-tab-pane label="额外投资" name="third">
                    <el-row> 
                        <el-col :span="24" class="pb15 mt10">
                            <el-button @click="addZtop" :disabled="flag =='N'" type="danger" plain>新增</el-button>
                        </el-col>
                    </el-row>
                     <div class="table_container">
                        <el-table
                            :data="ztops"
                            highlight-current-row
                            header-cell-class-name="table-header-class"
                            style="width:100%">
                            <el-table-column
                                property="invoiceno"
                                label="发票号码"
                                align='center'>
                                    <template slot-scope="scope">
                                        <el-input v-model="scope.row.invoiceno" :maxlength="9"
                                            :disabled="flag =='N'" @blur="checkInvoiceno(scope.$index,scope.row)"></el-input>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                    width="220"
                                    property="crtable"
                                    label="险种"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-row>
                                                <el-col :span="17">
                                                    <el-input v-model="scope.row.crtable" disabled />
                                                </el-col>
                                                <el-col :span="7" style="padding-left:5px!important;">
                                                    <el-button type="primary" :disabled="flag =='N'" plain @click="ztopxzClick(scope.$index,scope.row)">选择</el-button>
                                                </el-col>
                                            </el-row>
                                        </template>
                                </el-table-column>
                                <el-table-column
                                    property="origamt"
                                    label="金额"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input-number v-model="scope.row.origamt"
                                                style="margin-right:2px!important;" :min="0" :disabled="flag =='N'"
                                                :precision="2" :step="0.1" controls-position="right" />
                                        </template>
                                </el-table-column>
                                <el-table-column
                                    property="refnum"
                                    label="POS机系统参考号"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <el-input disabled v-model="scope.row.refnum"></el-input>
                                        </template>
                                </el-table-column>
                                <el-table-column
                                    property="paymentPeriod"
                                    label="操作"
                                    align='center'>
                                        <template slot-scope="scope">
                                            <span class="operationIcon" :disabled="flag =='N'" @click="removeZtop(scope.$index, scope.row)">
                                                <!-- 删除操作 -->
                                                <el-tooltip class="item" effect="light" content="删除" placement="top">
                                                    <i class="el-icon-delete"></i>
                                                </el-tooltip>
                                            </span>
                                        </template>
                                </el-table-column>
                        </el-table>                                
                    </div>  
                </el-tab-pane>
            </el-tabs>
        <!-- 弹框 投保内容（选择按钮）-->
        <el-dialog
            title="投保内容"
            :visible.sync="asIdDialogVisible"
            width="70%"
            center>
            <el-row>
                <el-col :span="24">
                    <el-table class="mt20"
                        ref="multipleTable"
                        :data="clnts"
                        @row-click="clntRowClick"
                        tooltip-effect="dark"
                        style="width: 100%">
                        <el-table-column
                        prop="secuityno"
                        label="证件号码">
                        </el-table-column>
                        <el-table-column
                        prop="surname"
                        label="姓名">
                        </el-table-column>
                        <el-table-column
                        prop="clntnum"
                        label="客户号">
                        </el-table-column>
                        <el-table-column
                        prop="anbAtCcd2"
                        label="年龄">
                        </el-table-column>
                        <el-table-column
                        prop="cltsex"
                        label="性别">
                        <template  slot-scope="scope">
                            <div v-for="sex in sexs" :key="sex.value">
                                <div v-if="sex.value==scope.row.cltsex">
                                    {{sex.label}}
                                </div>
                            </div>
                        </template>
                        </el-table-column>
                        <el-table-column
                        prop="flag"
                        label="FLAG">
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <span slot="footer" class="dialog-footer">
                <el-button @click="asIdDialogVisible = false">返 回</el-button>
            </span>
        </el-dialog>
        <!-- 弹框 选择险种（选择按钮）-->
        <el-dialog
            title="选择险种"
            :visible.sync="xzDialogVisible"
            width="70%"
            center>
            <el-row>
                <el-col :span="24">
                     <div class="searchPage">
                        <!-- 查询表单 -->
                        <el-form label-width="120px" class="search_container" >
                            <el-row>
                                <el-col :span="10">
                                    <el-form-item label="险种名称" prop="applnum">
                                        <el-input v-model="prdname01"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="14" class="text_right">
                                    <el-button type="primary" icon="el-icon-search" @click="cus3pfClick"></el-button>
                                    <el-button type="primary" plain  icon="el-icon-refresh"></el-button>
                                </el-col>
                            </el-row>
                        </el-form>
                    </div>
                    <el-table
                        ref="multipleTable"
                        :data="cus3pfList"
                        @row-click="cus3pfRowClick"
                        tooltip-effect="dark"
                        style="width: 100%">
                        <el-table-column
                            width="220"
                            prop="riskCodeAtt"
                            label="险种">
                        </el-table-column>
                        <el-table-column
                            prop="title"
                            label="险种名称">
                        </el-table-column>
                        <!--
                        <el-table-column
                            prop="prdname02"
                            label="附加对象">
                        </el-table-column>
                        <el-table-column
                            width="120"
                            prop="insname01"
                            label="险种关键字">
                        </el-table-column>
                        <el-table-column
                            width="120"
                            prop="insname02"
                            label="附加对象关键字">
                        </el-table-column>
                        <el-table-column
                            width="80"
                            prop="sismainins"
                            label="是否主险">
                        </el-table-column>
                        <el-table-column
                            width="80"
                            prop="ind01"
                            label="是否优惠期">
                        </el-table-column>
                        <el-table-column
                            width="80"
                            prop="ind02"
                            label="是否停售">
                        </el-table-column>
                        -->
                    </el-table>
                    <el-row>
                        <el-col :span="24">
                            <div class="pagination">
                                <el-pagination
                                    background
                                    v-if='paginations.total > 0'
                                    :page-sizes="paginations.pageSizes"
                                    :page-size="paginations.pageSize"
                                    :layout="paginations.layout"
                                    :total="paginations.total"
                                    :current-page='paginations.pageIndex'
                                    @current-change='handleCurrentChange'
                                    @size-change='handleSizeChange'>
                                </el-pagination>
                            </div>
                        </el-col>
                    </el-row>
                </el-col>
            </el-row>
            <span slot="footer" class="dialog-footer">
                <el-button @click="xzDialogVisible = false">返 回</el-button>
            </span>
        </el-dialog>
        <!-- 弹框额外投资 选择险种（选择按钮）-->
        <el-dialog
            title="选择险种"
            :visible.sync="ewDialogVisible"
            width="55%"
            center>
            <el-row>
                <el-col :span="24">
                     <div class="searchPage">
                        <!-- 查询表单 -->
                        <el-form label-width="120px" class="search_container" >
                            <el-row>
                                <el-col :span="10">
                                    <el-form-item label="险种名称" prop="applnum">
                                        <el-input v-model="prdname02"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="14" class="text_right">
                                    <el-button type="primary" icon="el-icon-search" @click="queryFundcrtable"></el-button>
                                    <el-button type="primary" plain  icon="el-icon-refresh"></el-button>
                                </el-col>
                            </el-row>
                        </el-form>
                    </div>
                    <el-table
                        ref="multipleTable"
                        :data="eufopkyList"
                        @row-click="eufopkyRowClick"
                        tooltip-effect="dark"
                        style="width: 100%">
                        <el-table-column
                            width="220"
                            prop="crtable"
                            label="险种代码">
                            <template slot-scope="scope">
                                <div>{{scope.row.crtable}}</div>
                            </template>
                        </el-table-column>
                        <el-table-column
                            prop="zpshortc"
                            label="险种名称">
                            <template slot-scope="scope">
                                <div>{{scope.row.crtable}}-{{scope.row.zpshortc}}</div>
                            </template>
                        </el-table-column>
                    </el-table>
                    <el-row>
                        <el-col :span="24">
                            <div class="pagination">
                                <el-pagination
                                    background
                                    v-if='paginations2.total > 0'
                                    :page-sizes="paginations2.pageSizes"
                                    :page-size="paginations2.pageSize"
                                    :layout="paginations2.layout"
                                    :total="paginations2.total"
                                    :current-page='paginations.pageIndex'
                                    @current-change='handleCurrentChangeEufo'
                                    @size-change='handleSizeChangeEufo'>
                                </el-pagination>
                            </div>
                        </el-col>
                    </el-row>
                </el-col>
            </el-row>
            <span slot="footer" class="dialog-footer">
                <el-button @click="ewDialogVisible = false">返 回</el-button>
            </span>
        </el-dialog>
        <el-dialog
            title="三位码转险种码"
            :visible.sync="polplnDialogVisible"
            width="70%"
            center>
            <el-row>
                <el-form label-width="120px" class="search_container" >
                    <el-row>
                        <el-col :span="8">
                            <el-form-item label="转换险种" prop="riskCode">
                                <el-input v-model="baseInfo.riskCode" disabled></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="主附险标记" prop="statFund">
                                <el-select v-model="baseInfo.statFund" disabled>
                                    <el-option
                                        v-for="item in statFundOptions"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <!-- <el-col :span="10">
                            <el-form-item label="主险险种" prop="mainriskCode">
                                <el-input  :disabled="flag =='N'" v-model="baseInfo.mainriskCode" @change="addPlanList"></el-input>
                            </el-form-item>
                        </el-col> -->
                        <el-col :span="8">
                            <el-form-item label="依附险种" prop="attachfor">
                                <!-- <el-input v-model="baseInfo.attachfor" @change="addPlanList"></el-input> -->
                                <el-select v-model="baseInfo.attachfor" @change="attChange" placeholder="">
                                    <el-option
                                        v-for="item in attachforList"
                                        :key="item.riskCode"
                                        :label="item.riskCode"
                                        :value="item.riskCode">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <!-- <el-col :span="10">
                            <el-form-item label="投保人出生日期" prop="appntBirthday">
                                <el-input :disabled="flag =='N'" v-model="baseInfo.appntBirthday" maxlength="8" placeholder="列：20200101"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="10">
                            <el-form-item label="被保人出生日期" prop="insuredBirthday">
                                <el-input :disabled="flag =='N'" v-model="baseInfo.insuredBirthday" maxlength="8" placeholder="列：20200101"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="10">
                            <el-form-item label="投保书首期应缴保险费" prop="pageFirstPayfee">
                                <el-input-number :disabled="flag =='N'" v-model="baseInfo.pageFirstPayfee" :controls="false" ></el-input-number>
                            </el-form-item>
                        </el-col> -->
                        <!-- <el-col :span="14" class="text_right">
                            <el-button type="primary" icon="el-icon-search" @click="queryFundcrtable"></el-button>
                            <el-button type="primary" plain  icon="el-icon-refresh"></el-button>
                        </el-col> -->
                    </el-row>
                </el-form>
                <el-col :span="24">
                    <el-table
                        ref="covertToPolplnTable"
                        :data="convertToPolplnInfo"
                        tooltip-effect="dark"
                        style="width: 100%">
                        <!-- <el-table-column
                            prop="statFund"
                            width="120"
                            label="主附险标识">
                            <template slot-scope="scope">
                                <el-select v-model="scope.row.statFund"  >
                                    <el-option
                                        v-for="item in statFundOptions"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                    </el-option>
                                </el-select>
                            </template>
                        </el-table-column> -->
                        <el-table-column
                            prop="riskCode"
                            width="80"
                            align='center'
                            label="险种">
                            <template slot-scope="scope">
                                <el-input v-model="scope.row.riskCode" disabled></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column
                            prop="insuYear"
                            align='center'
                            label="保障期">
                            <template slot-scope="scope">
                                 <el-row :span="24">
                                    <el-col :span="12">
                                        <el-input v-model="scope.row.insuYear" 
                                            :disabled="scope.$index != (convertToPolplnInfo.length - 1)"
                                            @change="scope.row.insuYear = isNumber(scope.row.insuYear)" maxlength="2"></el-input>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-select v-model="scope.row.insuYearFlag" 
                                            :disabled="scope.$index != (convertToPolplnInfo.length - 1)"
                                            placeholder="">
                                            <el-option
                                                v-for="item in prmswOptions"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-col>
                                </el-row>
                            </template>
                        </el-table-column>
                        <el-table-column
                            prop="payendyear"
                            align='center'
                            label="缴费期">
                            <template slot-scope="scope">
                                <el-row :span="24">
                                    <el-col :span="12">
                                         <el-input v-model="scope.row.payendyear" 
                                            :disabled="scope.$index != (convertToPolplnInfo.length - 1)"
                                            @change="scope.row.payendyear = isNumber(scope.row.payendyear)" maxlength="2" ></el-input>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-select v-model="scope.row.payendyearflag" 
                                            :disabled="scope.$index != (convertToPolplnInfo.length - 1)"
                                            placeholder="">
                                            <el-option
                                                v-for="item in rskswOptions"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-col>
                                </el-row>
                            </template>
                        </el-table-column>
                        <el-table-column
                            prop="getYear"
                            align='center'
                            label="年金领取">
                            <template slot-scope="scope">
                                <el-row :span="24">
                                    <el-col :span="12">
                                        <el-input v-model="scope.row.getYear"
                                            :disabled="scope.$index != (convertToPolplnInfo.length - 1)
                                                        ||(scope.$index == (convertToPolplnInfo.length - 1)
                                                        && convertRow.sdrawdate != '1')"
                                            @change="scope.row.getYear = isNumber(scope.row.getYear)" maxlength="2" ></el-input>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-select v-model="scope.row.getYearFlag" 
                                            :disabled="scope.$index != (convertToPolplnInfo.length - 1)
                                                        ||(scope.$index == (convertToPolplnInfo.length - 1)
                                                        && convertRow.sdrawdate != '1')"
                                            placeholder="">
                                            <el-option
                                                v-for="item in getYearFlag"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-col>
                                </el-row>                
                            </template>
                        </el-table-column>
                        <!-- <el-table-column
                            width="120"
                            prop="payMode"
                            label="缴别">
                            <template slot-scope="scope">
                                <el-select :disabled="flag =='N'" v-model="scope.row.payMode"  >
                                    <el-option
                                        v-for="item in billfreq"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                    </el-option>
                                </el-select>
                            </template>
                        </el-table-column> -->
                        <el-table-column
                            prop="sumins"
                            align='center'
                            label="险种保额">
                            <template slot-scope="scope">
                                <!-- <el-input v-model="scope.row.sumins"></el-input> -->
                                <el-input-number v-model="scope.row.sumins" 
                                    :disabled="scope.$index != (convertToPolplnInfo.length - 1)"
                                    :controls="false" ></el-input-number>
                            </template>
                        </el-table-column>
                        <el-table-column
                            prop="zbinstprem"
                            align='center'
                            label="险种保费">
                            <template slot-scope="scope">
                                <!-- <el-input v-model="scope.row.zbinstprem"></el-input> -->
                                <el-input-number v-model="scope.row.zbinstprem" 
                                    :disabled="scope.$index != (convertToPolplnInfo.length - 1)
                                                ||(scope.$index == (convertToPolplnInfo.length - 1)
                                                    && convertRow.spaylimit != '1')"
                                    :controls="false" ></el-input-number>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <span slot="footer" class="dialog-footer">
                <el-button @click="polplnDialogVisible = false">返 回</el-button>
                <el-button @click="convertToPolplnFun" :disabled="flag =='N'">提交</el-button>
            </span>
        </el-dialog>
    </div>
</template>
<script>
    import constant from '@/utils/constant';
    import { getCus3pfList,checkPolplnInvest,checkEuaapkyCaldate,
            checkEuaapkyBillfreq,queryFundcrtable,checkInvoiceno,
            investCheckId,convertToPolpln,checkZbinstprem,checkSumins } from "@/api/policyRecord/materialsMaintain/insurance.js";     
    export default {
        data(){
            return {
				flag03:'',
				rateChange:"0",//页面费率是否被改变，0未改变， 1改变
                value:'',
                asIdDialogVisible:false,//选择客户
                activeTab:"first",
                xzDialogVisible: false,
                ewDialogVisible: false,
                sexs:[{value:'M',label:'男'},
                    {value:'F',label:'女'},
                    {value:'U',label:'不明'}  
                ],
                crunit:[//保额单位
                    {value:'A1',label:'元'},
                    {value:'A3',label:'千元'},
                    {value:'A4',label:'万元'},
                    {value:'B1',label:'计划'},
                    {value:'C1',label:'单位'}  
                ],
                billfreq:[
                    {value:'00',label:'00-趸缴'},
                    {value:'01',label:'01-年缴'},
                    {value:'02',label:'02-半年缴'},
                    {value:'04',label:'04-季缴'},
                    {value:'12',label:'12-月缴'}
                ],
				//费率
				flag03s:[
				    {value:'1',label:'1-非吸烟超优体'},
				    {value:'2',label:'2-非吸烟优选体'},
				    {value:'3',label:'3-标准体'},
				    {value:'4',label:'4-吸烟体'}
				],
				
                billchnl:[
                    {value:'G',label:'G-团体缴费'},
                    {value:'C', label:'C-到指定地点缴费'},
                    {value:'D',label:'D-银行自动转帐'},
                    {value:'N', label:'N'}
                ],
                uwind:[
                    {value:'',label:''},
                    {value:'Y',label:'是'},
                    {value:'N',label:'否'}
                ],
                flag15s:[
                    {value:'A',label:'承保后交易'},
                    {value:'B',label:'犹豫期后交易'},
                    {value:'',label:''}
                ],
                rskswOptions:[
                    {value:'',label:''},
                    {value:'A',label:'岁'},
                    {value:'Y',label:'年'}
                ],
                prmswOptions:[
                    {value:'',label:''},
                    {value:'A', label:'岁'},
                    {value:'Y',label:'年'}
                ],
                getYearFlag:[
                    {value:'',label:''},
                    {value:'A',label:'岁'},
                    {value:'Y',label:'年'}
                ],
                statFundOptions:[
                    {value:'M',label:'主约'},
                    {value:'R',label:'附约'}
                ],
                attachforList:[],
                baseInfo: { 
                    riskCode:'',statFund:'',mainriskCode:'',
                    attachfor:'',appntBirthday:'',insuredBirthday:'',
                    pageFirstPayfee:'',appldate:''
                },
                polplnDialogVisible: false,
                convertToPolplnInfo: [],
                selectIndex: null,
                selectRow: {}, //投保内容被选中的行
                convertRow: {}, //需转换的险种
                euabs: [],
                euaa: {},
                plybnfts: {},
                ztops: [],
                euais: [],
                euad1:{},//投保人信息
                euad2:{},//被保人信息
                rules: {},
                insureDataForm: this.insureData,
                clnts: [],
                euabSelectIndenx: null,
                ztopSelectIndenx: null,
                cus3pfList: [],
                paginations: {
                    total: 0,        // 总数
                    pageIndex: 1,  // 当前位于哪页
                    pageSize: 10,   // 1页显示多少条
                    pageSizes: [5, 10, 15, 20],  //每页显示多少条
                    layout: "total, sizes, prev, pager, next, jumper"   // 翻页属性
                },
                prdname01: '',
                prdname02: '',
                eufopkyList: [],
                paginations2: {
                    total: 0,        // 总数
                    pageIndex: 1,  // 当前位于哪页
                    pageSize: 10,   // 1页显示多少条
                    pageSizes: [5, 10, 15, 20],  //每页显示多少条
                    layout: "total, sizes, prev, pager, next, jumper"   // 翻页属性
                },
                euaisTemList: null,
            }
        },
        props:{
			flag:{
				type:String
			},
            insureData:{
                type: Object,
            },
            getChildrenData: {
                type: Function,
                default: null,
            },
        },
        mounted(){
            this.reloadInsureData(null);
        },
        methods: {
			//改变费率
			changeRate(value){
				if (this.flag03 == this.insureDataForm.euad2.flag03) {
					this.rateChange = '0';
				} else {
					this.insureDataForm.euad2.flag03 = this.flag03;
					this.rateChange = '1';
				}
				this.insureDataForm['rateChange'] = this.rateChange;
			},	
            removeEuab(index,row){
				if (this.flag == 'N') {
					return null;
				}
                let title = '确定删除?'
                if(this.euabs.length > 1 && row.statFund == 'M'){ 
                    title = '删除主约会连同所有附约删除,确定要删除此笔资料?'
                }
                this.$confirm(title, '提示', {
                    confirmButtonText: '确定',
					cancelButtonClass: 'btn-cancel',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    if(this.euabs.length > 1 && row.statFund == 'M'){ 
                        this.euabs = [];
                    }else{
                        this.euabs.splice(index,1);
                    }
                    this.defaultOneEuab();
                    this.resetEuabRownum();
                }).catch(() => { });
            },
            addEuab(){
                let euab = {
                   "applnum": "","chdrnum": "","clntnum": "","polpln": "",
                    "sumins": 0, "prat": 0,"zlinstprem": 0,
                    "zbinstprem": 0,"instprem": 0,
                    "premCessTerm": 0, "approval": "","polappusr": "",
                    "aprvdate": 0,"uwind": "","uwuser": "", "huwdcdte": 0,
                    "crunit": "", "crtable": "", "crtype": "",
                    "prmsw": "", "rskSw": "","riskCessTerm": 0,
                    "statFund": "R","cnttype": "","acctype": "",
                    "wplnind": "","planlmt": 0, "cedprm": 0,
                    "phyExamMult": 0, "mortcls": "", "fromdate": 0,
                    "todate": 0, "crtuser": "", "dtecrt": 0, 
                    "crttime": 0,"userProfile": "","jobName": "",
                    "datime": "", "dsipct": 0,"firstprem": 0,
                    "chdrno": 0, "age": 0,"suminsReadonly": false,
                    "zbinstpremReadonly": false,"asChdrno":"1","asId":"",
                    "asName":"","asSex":"","asAge":0,"rowNum": "",
                    "oldClntnum": "","title": "", "tableDesc": ""
                }
                this.euabs.push(euab);
                this.resetEuabRownum();
            },
            resetEuabRownum(){//重新rowNum赋值
                for(let i = 0; i < this.euabs.length; i++){
                    this.euabs[i].rowNum = (i+1)+'';
                }
            },
            copyEuab(){
               let euab = {
                    "applnum": "","chdrnum": "","clntnum": "","polpln": "",
                    "sumins": 0, "prat": 0,"zlinstprem": 0,
                    "zbinstprem": 0,"instprem": 0,
                    "premCessTerm": 0, "approval": "","polappusr": "",
                    "aprvdate": 0,"uwind": "","uwuser": "", "huwdcdte": 0,
                    "crunit": "", "crtable": "", "crtype": "",
                    "prmsw": "", "rskSw": "","riskCessTerm": 0,
                    "statFund": "R","cnttype": "","acctype": "",
                    "wplnind": "","planlmt": 0, "cedprm": 0,
                    "phyExamMult": 0, "mortcls": "", "fromdate": 0,
                    "todate": 0, "crtuser": "", "dtecrt": 0, 
                    "crttime": 0,"userProfile": "","jobName": "",
                    "datime": "", "dsipct": 0,"firstprem": 0,
                    "chdrno": 0, "age": 0,"suminsReadonly": false,
                    "zbinstpremReadonly": false,"asChdrno":"1","asId":"",
                    "asName":"","asSex":"","asAge":0,"rowNum": "",
                    "oldClntnum": "","title": "", "tableDesc": ""
                }
                if(this.euabSelectIndenx == null){
                     this.$message({
                        message: '请选择中一行投保内容！',
                        type: 'error'
                    });
                    return;
                }
                let euabTem = this.euabs[this.euabSelectIndenx];
                euab.clntnum = euabTem.clntnum;
                euab.asName = euabTem.asName;
                euab.asAge = euabTem.asAge;
                euab.mortcls = euabTem.mortcls;
                euab.asSex = euabTem.asSex;
                euab.asId = euabTem.asId;
                this.euabs.push(euab);
                this.resetEuabRownum();
            },
            defaultOneEuab(){//默认投保内容一主险
                if(this.euabs.length > 0){
                    if(!this.euabs[0].clntnum){
                        this.euabs[0].clntnum = this.euad2.clntnum;
                        this.euabs[0].asName = this.euad2.surname;
                        this.euabs[0].asAge = this.euad2.anbAtCcd2;
                        //this.euabs[0].mortcls = this.euad2.mortcls;
                        this.euabs[0].asSex = this.euad2.cltsex;
                        this.euabs[0].asId = this.euad2.secuityno;
                    }
                    return false;
                }
                let euab = {
                    "applnum": "","chdrnum": "","clntnum": "","polpln": "",
                    "sumins": 0, "prat": 0,"zlinstprem": 0,
                    "zbinstprem": 0,"instprem": 0,
                    "premCessTerm": 0, "approval": "","polappusr": "",
                    "aprvdate": 0,"uwind": "","uwuser": "", "huwdcdte": 0,
                    "crunit": "", "crtable": "", "crtype": "",
                    "prmsw": "", "rskSw": "","riskCessTerm": 0,
                    "statFund": "M","cnttype": "","acctype": "",
                    "wplnind": "","planlmt": 0, "cedprm": 0,
                    "phyExamMult": 0, "mortcls": "", "fromdate": 0,
                    "todate": 0, "crtuser": "", "dtecrt": 0, 
                    "crttime": 0,"userProfile": "","jobName": "",
                    "datime": "", "dsipct": 0,"firstprem": 0,
                    "chdrno": 0, "age": 0,"suminsReadonly": false,
                    "zbinstpremReadonly": false,"asChdrno":"1","asId":"",
                    "asName":"","asSex":"","asAge":0,"rowNum": "",
                    "oldClntnum": "","title": "", "tableDesc": ""
                }
                euab.clntnum = this.euad2.clntnum;
                euab.asName = this.euad2.surname;
                euab.asAge = this.euad2.anbAtCcd2;
                //euab.mortcls = this.euad2.mortcls;
                euab.asSex = this.euad2.cltsex;
                euab.asId = this.euad2.secuityno;
                euab.statFund = 'M';
                euab.rowNum = '1';
                this.euabs.push(euab);
            },
            removeZtop(index,row){
                if (this.flag == 'N') {
					return null;
				}
                this.ztops.splice(index,1);
                console.info(row);
            },
            addZtop(){
                let ztop = {
                    "invoiceno": "","crtable": "",
                    "origamt": "","refnum": "",
                    "flag": "", "chdrnum": "",
                    "chdrcoy": "", "branch": "",
                    "life": "", "tranno": "",
                    "oldCrtable": "", "dataFlag": "",
                }
                this.ztops.push(ztop);
                this.insureDataForm.ztops = this.ztops;
            },
            reloadInsureData(insureData){
                console.info("投资型投保数据加载",insureData);
                if(insureData != null){
                    this.insureDataForm = insureData;
                }
                this.euabs = this.insureDataForm.euabs;
                this.euaa = this.insureDataForm.euaa;
                this.plybnfts = this.insureDataForm.plybnfts;
                this.ztops = this.insureDataForm.ztops;
                let euais = this.insureDataForm.euais;
                let euad1 = this.insureDataForm.euad1;
                let euad2 = this.insureDataForm.euad2;
				this.flag03 = euad2.flag03;
                this.clnts = [];
                let flag = '投保内容';
                if(euad1.clntnum == euad2.clntnum){
                    this.clnts.push({secuityno:euad1.secuityno,surname:euad1.surname,
                                    clntnum:euad1.clntnum,anbAtCcd2:euad1.anbAtCcd2,
                                    cltsex:euad1.cltsex,mortcls:euad1.mortcls,
                                    flag:flag});
                }else{  
                    this.clnts.push({secuityno:euad1.secuityno,surname:euad1.surname,
                                    clntnum:euad1.clntnum,anbAtCcd2:euad1.anbAtCcd2,
                                    cltsex:euad1.cltsex,mortcls:euad1.mortcls,
                                    flag:flag});
                    this.clnts.push({secuityno:euad2.secuityno,surname:euad2.surname,
                                    clntnum:euad2.clntnum,anbAtCcd2:euad2.anbAtCcd2,
                                    cltsex:euad2.cltsex,mortcls:euad2.mortcls,
                                    flag:flag});                
                }
                this.euad1 = euad1;
                this.euad2 = euad2;
                this.defaultOneEuab();
                this.euaisTemList = this.insureDataForm.euaisTemList;
                this.loadEuais();
            },
            getInsureData(){
                this.insureDataForm.euabs = this.euabs;
                this.insureDataForm.euaa = this.euaa;
                this.insureDataForm.plybnfts = this.plybnfts;
                this.insureDataForm.ztops = this.ztops;
                this.insureDataForm.euais = this.euais;
                return this.insureDataForm;
            },
            changeBillchnl(){
                this.$emit('changeBillchnl',this.euaa.billchnl);
            },
            loadEuais(){
                let mainCrtable = "";
                for(let i = 0 ; i < this.euabs.length; i++){
                    if(this.euabs[i].statFund == 'M'){
                        mainCrtable = this.euabs[i].crtable;
                        break;
                    }
                }
                this.euais = [];
                if(mainCrtable == 'UR02'){
                    let flagAdd = false;
                    for(let j = 0 ; j < this.euabs.length ; j++){
                        let ccrtable = this.euabs[j].crtable;
                        if(ccrtable == 'UR02'){
                            flagAdd = true;
                            break;
                        }
                    }
                    if(flagAdd){
                        for(let i = 0 ; i < this.euaisTemList.length; i++){
                            if('UR02' == this.euaisTemList[i].crtable){
                                this.euais.push(this.euaisTemList[i]);
                            }
                        }
                    }
                    flagAdd = false;
                    for(let j = 0 ; j < this.euabs.length ; j++){
                        let ccrtable = this.euabs[j].crtable;
                        if(ccrtable == 'UNV1'){
                            flagAdd = true;
                            break;
                        }
                    }
                    if(flagAdd){
                        for(let i = 0 ; i < this.euaisTemList.length; i++){
                            if('UNV1' == this.euaisTemList[i].crtable){
                                this.euais.push(this.euaisTemList[i]);
                            }
                        }
                    }
                }else if(mainCrtable == 'UR03'){
                    let flagAdd = false;
                    for(let j = 0 ; j < this.euabs.length ; j++){
                        let ccrtable = this.euabs[j].crtable;
                        if(ccrtable == 'UR03'){
                           flagAdd = true;
                           break;
                        }
                    }
                    if(flagAdd){
                        for(let i = 0 ; i < this.euaisTemList.length; i++){
                            if('UR03' == this.euaisTemList[i].crtable){
                                this.euais.push(this.euaisTemList[i]);
                            }
                        }
                    }
                    flagAdd = false;
                    for(let j = 0 ; j < this.euabs.length ; j++){
                        let ccrtable = this.euabs[j].crtable;
                        if(ccrtable == 'UNV2'){
                            flagAdd = true;
                            break;
                        }
                    }
                    if(flagAdd){
                        for(let i = 0 ; i < this.euaisTemList.length; i++){
                            if('UNV2' == this.euaisTemList[i].crtable){
                                this.euais.push(this.euaisTemList[i]);
                            }
                        }
                    }
                }else if(mainCrtable != ''){
                    for(let i = 0 ; i < this.euaisTemList.length; i++){
                        if(mainCrtable == this.euaisTemList[i].crtable){
                            this.euais.push(this.euaisTemList[i]);
                        }
                    }
                }
                this.insureDataForm.euais = this.euais;
            },
            clntRowClick(row, column, event){
                this.euabs[this.euabSelectIndenx].clntnum = row.clntnum;
                this.euabs[this.euabSelectIndenx].asName = row.surname;
                this.euabs[this.euabSelectIndenx].asAge = row.anbAtCcd2;
                this.euabs[this.euabSelectIndenx].mortcls = row.mortcls;
                this.euabs[this.euabSelectIndenx].asSex = row.cltsex;
                this.euabs[this.euabSelectIndenx].asId = row.secuityno;
                this.asIdDialogVisible = false;
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let para = {
                    clntnum: this.euabs[this.euabSelectIndenx].clntnum,
                    rowNum: this.euabs[this.euabSelectIndenx].rowNum,
                    euaa: this.euaa,
                    euabList:this.euabs,
                    euad1:this.insureDataForm.euad1,
                    euad2:this.insureDataForm.euad2
                };
                investCheckId(para).then(res =>{
                    if(res.resultCode == constant.SUCCESS){
                        let data = res.data;
                        if(data.euabpkyCurr != undefined){
                           this.euabs[this.euabSelectIndenx] = data.euabpkyCurr;
                           let list = JSON.parse(JSON.stringify(this.euabs));
                           this.euabs = list;
                        }
                        if(data.info != undefined){
                            this.$message({
                                message: data.info,
                                type: 'error'
                            });
                        }
                    }
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })
            },
            euabRowClick(row, column, event){
                //console.info(row);
                //console.info(column);
                //console.info(event);
                this.euabSelectIndenx = row.rowNum - 1;
            },
            euabChoiceClick(index,row){
                console.info(index);
                this.euabSelectIndenx = index;
                this.asIdDialogVisible = true;
            },
            handleSizeChange(pageSize) {// 每页多少条切换
                this.paginations.pageSize = pageSize;
                this.cus3pfClick();
            },
            handleCurrentChange(page) {// 上下分页
                this.paginations.pageIndex = page;
                this.cus3pfClick();
            },
            xzClick(index,row){
                //this.xzDialogVisible = true;
                this.selectRow = row;
                this.selectIndex = index;
                let statFund = this.selectRow.statFund;
                if(statFund=='R'){
                    this.prdname01 = '';
                }
                this.cus3pfClick();
            },
            cus3pfClick(){
                let statFund = this.selectRow.statFund;
                let sismainins = (statFund == 'M') ? '1' : '0';
                let inputnum01 = '';
                if(sismainins == '0'){
                    for(let i = 0;i < this.euabs.length ; i++){
                        if(this.euabs[i].riskCode){
                            inputnum01 += '\''+this.euabs[i].riskCode+'\',';
                        }                 
                    }
                    if(inputnum01.length > 0){
                        inputnum01 = inputnum01.substring(0,inputnum01.length-1);
                    }
                    let mainriskCode = this.euabs[0].riskCode;
                    if(mainriskCode == null||mainriskCode == ''){
                        this.$message({
                            message: '主险3位码为空！不可选择附加险！',
                            type: 'error'
                        });
                        return;
                    }
                }
                this.xzDialogVisible = true;
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let para = {
                    pageNumber: this.paginations.pageIndex,
                    pageSize: this.paginations.pageSize,
                    prdname01: this.prdname01,
                    sismainins: sismainins,
                    inputnum01: inputnum01,
                };
                getCus3pfList(para).then(res =>{
                    if(res.resultCode == 0){
                        this.paginations.total = res.data.total;
                        this.cus3pfList = res.data.list;
						//增加滤操作
						let tmp  ;
						this.cus3pfList = this.cus3pfList.filter((item,index) =>{
							let isContain = true;
							if (!tmp){
								tmp = item.riskCodeAtt;
							} else {
								if (tmp === item.riskCodeAtt){
									isContain =  false;
								} else {
									tmp = item.riskCodeAtt
								}
							}
							return isContain;
						})
                        this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                        //this.xzDialogVisible = true;
                    }
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })
            },
            cus3pfRowClick(row){
                // this.xzDialogVisible = false;
                this.attachforList = [];
                for(let i = 0; i < this.euabs.length; i++){
                    if(this.euabs[i].riskCode){
                        let att = {riskCode:this.euabs[i].riskCode,
                                title:this.euabs[i].riskCode};
                        this.attachforList.push(att);     
                    }
                }
                let addFlag = true;
                for(let i = 0; i < this.attachforList.length; i++){
                    let riskCode = this.attachforList[i].riskCode;
                    if(riskCode == row.riskCode){
                        addFlag = false;
                        break;
                    }
                }
                if(addFlag){
                    let att = {riskCode:row.riskCode,
                                title:row.riskCode};
                    this.attachforList.push(att);
                }
                this.convertRow = row;
                this.convertToPolplnInfo = [];
                let info = {
                    riskCode: row.riskCode,
                    statFund: '',
                    insuYear: '',
                    insuYearFlag: '',
                    payendyear: '',
                    payendyearflag: '',
                    getYear: '',
                    getYearFlag: '',
                    sumins: '',
                    zbinstprem: '',
                    payMode:this.euaa.billfreq
                }
                if(this.selectRow.statFund == 'M') {
                    this.baseInfo.mainriskCode = row.riskCode;
                    this.baseInfo.attachfor = row.riskCode;
                    this.baseInfo.riskCode =  row.riskCode;
                    this.baseInfo.statFund = 'M';
                    info.statFund = 'M';
                    /**info.insuYear = this.selectRow.riskCessTerm;
                    info.insuYearFlag = this.selectRow.rskSw;
                    info.payendyear = this.selectRow.premCessTerm;
                    info.payendyearflag = this.selectRow.prmsw;
                    info.getYear = '';
                    info.getYearFlag = '';
                    info.sumins = this.selectRow.sumins;
                    info.zbinstprem = this.selectRow.zbinstprem;**/
                    this.convertToPolplnInfo.push(info);
                } else {
                    info.statFund = 'R';
                    let mainriskCode = this.euabs[0].riskCode;
                    this.baseInfo.mainriskCode = mainriskCode;
                    //this.baseInfo.attachfor = this.euabs[0].riskCode;
                    if(mainriskCode == null||mainriskCode == ''){
                        this.$message({
                            message: '主险3位码为空！不可选择附加险！',
                            type: 'error'
                        });
                        return;
                    }
                    //this.baseInfo.attachfor = this.euabs[0].riskCode;
                    this.baseInfo.riskCode =  row.riskCode;
                    this.baseInfo.statFund = info.statFund;
                    let mainInfo = {
                         riskCode: this.euabs[0].riskCode==null?'':this.euabs[0].riskCode,
                         statFund: 'M',
                         insuYear: this.euabs[0].riskCessTerm==null?'':this.euabs[0].riskCessTerm,
                         insuYearFlag: this.euabs[0].rskSw==null?'':this.euabs[0].rskSw,
                         payendyear: this.euabs[0].premCessTerm==null?'':this.euabs[0].premCessTerm,
                         payendyearflag: this.euabs[0].prmsw==null?'':this.euabs[0].prmsw,
                         getYear: this.euabs[0].getYear==null?'':this.euabs[0].getYear,
                         getYearFlag: this.euabs[0].getYearFlag==null?'':this.euabs[0].getYearFlag,
                         sumins: this.euabs[0].sumins==null?'':this.euabs[0].sumins,
                         zbinstprem: this.euabs[0].zbinstprem==null?'':this.euabs[0].zbinstprem,
                         payMode:this.euaa.billfreq
                    }
                    this.convertToPolplnInfo.push(mainInfo);
                    this.convertToPolplnInfo.push(info);
                    this.baseInfo.attachfor = row.riskCodeAtt.split('-')[0];
                    this.attChange();
                }
                this.polplnDialogVisible = true;
            },
            checkPolplnInvest(index,row){
                if(row.polpln==null||row.polpln==''){
                    return;
                }
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                this.euabSelectIndenx = index;
                let para = {
                    euad1: this.insureDataForm.euad1,
                    euad2: this.insureDataForm.euad2,
                    euaa: this.euaa,
                    polpln: row.polpln,
                    euabList: this.euabs,
                    rowNum: row.rowNum
                };
                checkPolplnInvest(para).then(res =>{
                    if(res.resultCode == constant.SUCCESS){
                        if(res.data != null && res.data != undefined){
                            console.info(res.data);
                            if(res.data.euabpkyCurr != undefined){
                                this.euabs[this.euabSelectIndenx] = res.data.euabpkyCurr;
								//不要清空保额 ---褚四锋
								this.euabs[this.euabSelectIndenx].sumins = row.sumins;
								//不要清空保额 ---褚四锋
                                this.euabs[this.euabSelectIndenx].statFund = row.statFund;
                                let list = JSON.parse(JSON.stringify(this.euabs));
                                this.euabs = list;
                            }
                            if(res.data.euaapkyForm_nextbdate != undefined){
                                this.euaa.nextbdate = res.data.euaapkyForm_nextbdate;
                            }
                            if(res.data.euaapkyForm_firstpremTotal != undefined){
                                this.euaa.firstpremTotal = res.data.euaapkyForm_firstpremTotal;
                            }
                            if(res.data.info != undefined){
                                this.$message({
                                    message: res.data.info,
                                    type: 'error'
                                });
                            }
							//更改的是主险
							if(res.data.euabpkyCurr.statFund =='M' ) {
							// 	// this.euais.forEach(item =>{
							// 	// 	item.crtable = res.data.euabpkyCurr.crtable
							// 	// 	item.id = null;
							// 	// })
								this.euais =[];
								this.loadEuais();
							}	
                        }
                    }
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                }).catch(err =>{
                    row.polpln = '';
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                    console.log(err);
                })
            },
            billfreqChange() {
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let para = {euaa:this.euaa,
                            euad2:this.euad2,
                            euabs:this.euabs};
                checkEuaapkyBillfreq(para).then(res =>{
                    if(res.resultCode == constant.SUCCESS && res.data){
                        let data = res.data;
                        if(data.euaapkyForm_caldate != undefined){
                           this.euaa.caldate = data.euaapkyForm_caldate;
                        }
                        if(data.euaapkyForm_caldate_readonly != undefined){
                           this.euaa.isCaldateRead = data.euaapkyForm_caldate_readonly;
                        }
                        if(data.euaapkyForm_billchnl != undefined){
                           this.euaa.billchnl = data.euaapkyForm_billchnl;
                        }
                        if(data.euaapkyForm_nextbdate != undefined){
                           this.euaa.nextbdate = data.euaapkyForm_nextbdate;
                        }
                        if(data.euaapkyForm_firstpremTotal != undefined){
                           this.euaa.firstpremTotal = data.euaapkyForm_firstpremTotal;
                        }
                        if(data.euabpkyList != undefined){
                            this.euabs = JSON.parse(JSON.stringify(data.euabpkyList));
                        }
                    }
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                }).catch(err =>{
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                    console.log(err);
                })
            },
            checkUnitAllocPercAmt(obj) {
                let value = obj.target.value;
                if (value == undefined || value == ''){
                    obj.target.value="0";
                }else{
                    //var value = fun_checkNubmerDecimal(object,6,0);
                    if(value%5!=0){
                        this.$message({
                            message: '基金所占比率需为5 之倍数, 请重输！！',
                            type: 'error'
                        });
                        obj.target.value="0";
                    }
                }
            },
            checkInvoiceno(index,row) {
                let value = row.invoiceno;
                if(value.length != 9){
                    this.$message({
                        message: '请输入正确发票号码',
                        type: 'error'
                    });
                    row.invoiceno = "";
                    return false;
                }
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let para = {
                    invoiceno: row.invoiceno
                };
                checkInvoiceno(para).then(res => {
                    if(res.resultCode == constant.SUCCESS){
                        let data = res.data;
                        if(data != null){
                            if(data.ztopForm_origamt != undefined){
                                row.origamt = data.ztopForm_origamt;
                            }
                            if(data.info != undefined){
                                this.$message({
                                    message: data.info,
                                    type: 'error'
                                });
                            }
                        }
                        this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                    }
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })
            },
            checkEuaapkyCaldate(){
                let caldate = this.euaa.caldate.toString();
                if(caldate.length != 8){
                    this.$message({
                        message: '日期长度不对!!',
                        type: 'error'
                    });
                    this.euaa.caldate = 0;
                    this.$refs.caldate.focus();
                    return false;
                }
                if(caldate != 0 && !caldate.match( /\d{8}$/)){
                    this.$message({
                        message: '日期格式不对!!',
                        type: 'error'
                    });
                    this.euaa.caldate = 0;
                    this.$refs.caldate.focus();
                    return false;
                }
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let dataForm = this.getChildrenData();
                let para = {
                    euaa: dataForm.euaa,
                    euad1: dataForm.euad1,
                    euad2: dataForm.euad2,
                    euabList: this.euabs
                };
                checkEuaapkyCaldate(para).then(res => {
                    if(res.resultCode == constant.SUCCESS){ 
                        let data = res.data;
                        if(data != null){
                            if(data.euaapkyForm_caldate != undefined){
                                this.euaa.caldate = data.euaapkyForm_caldate;
                            }
                            if(data.euaapkyForm_nextbdate != undefined){
                                this.euaa.nextbdate = data.euaapkyForm_nextbdate;
                            }
                            if(data.euadpky1VO != undefined){
                                this.euad1 = data.euadpky1VO;
                            }
                            if(data.euadpky2VO != undefined){
                                this.euad2 = data.euadpky2VO;
                            }
                            if(data.euabpkyList != undefined){
                                this.euabs = data.euabpkyList;
                            }
                            if(data.info != undefined){
                                this.$message({
                                    message: data.info,
                                    type: 'error'
                                });
                                this.$refs.caldate.focus();
                            }
                        }
                    }
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })    
            },
            eufopkyRowClick(row){
                let flag = false;
                for(let i = 0 ;i < this.euabs.length; i++){
                    if(this.euabs[i].crtable == row.crtable){
                        flag = true;
                        break;
                    }
                }
                if(flag){
                    this.ztops[this.ztopSelectIndenx].crtable = row.crtable;
                    this.ewDialogVisible = false;
                }else{
                    this.$message({
                        message: '不存在'+row.crtable+'产品,请重输选择!!!!!',
                        type: 'error'
                    });
                }  
            },
            queryFundcrtable(){
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let para = {
                    pageNumber: this.paginations2.pageIndex,
                    pageSize: this.paginations2.pageSize,
                    prdname02: this.prdname02
                };
                queryFundcrtable(para).then(res =>{
                    if(res.resultCode == constant.SUCCESS){
                        this.paginations2.total = res.data.total;
                        this.eufopkyList = res.data.list;
                        //this.xzDialogVisible = true;
                    }
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })
            },
            ztopxzClick(index,row){
                this.ztopSelectIndenx = index;
                this.ewDialogVisible = true;
                this.queryFundcrtable();
            },
            handleSizeChangeEufo(pageSize) {// 每页多少条切换
                this.paginations2.pageSize = pageSize;
                this.queryFundcrtable();
            },
            handleCurrentChangeEufo(page) {// 上下分页
                this.paginations2.pageIndex = page;
                this.queryFundcrtable();
            },
            getSummaries(param) {
                const { columns, data } = param;
                const sums = [];
                columns.forEach((column, index) => {
                    if (index == '7' || index == '8') {
                        const values = data.map(item => Number(item[column.property]));
                        if (!values.every(value => isNaN(value))) {
                            sums[index] = values.reduce((prev, curr) => {
                            const value = Number(curr);
                            if (!isNaN(value)) {
                                return prev + curr;
                            } else {
                                return prev;
                            }
                            }, 0);
                            sums[index] = sums[index].toFixed(2);
                        } else {
                            sums[index] = 'N/A';
                        }
                    }else{
                        sums[index] = '';
                    }
                });
                return sums;
            },
            changeEuabs(euabStrs){
                let euabs = JSON.parse(euabStrs);
                this.euabs = euabs;
            },
            attChange(){
               let baseMainriskCode = this.baseInfo.mainriskCode
               let baseAttachfor = this.baseInfo.attachfor;
               let baseRiskCode =  this.baseInfo.riskCode;
               let baseStatFund =  this.baseInfo.statFund;
               if(baseStatFund == 'R'){
                   if(baseAttachfor != baseRiskCode){
                       let info = {
                                riskCode: baseAttachfor,
                                statFund: 'R',
                                insuYear: '',
                                insuYearFlag: '',
                                payendyear: '',
                                payendyearflag: '',
                                getYear: '',
                                getYearFlag: '',
                                sumins: '',
                                zbinstprem: '',
                                payMode:this.euaa.billfreq
                            };
                        for(let i = 0; i < this.euabs.length; i++){
                            if(baseAttachfor == this.euabs[i].riskCode){
                                info.insuYear = this.euabs[i].riskCessTerm==null?'':this.euabs[i].riskCessTerm;
                                info.nsuYearFlag = this.euabs[i].rskSw==null?'':this.euabs[i].rskSw;
                                info.payendyear = this.euabs[i].premCessTerm==null?'':this.euabs[i].premCessTerm;
                                info.payendyearflag = this.euabs[i].prmsw==null?'':this.euabs[i].prmsw;
                                info.getYear =  this.euabs[i].getYear==null?'':this.euabs[i].getYear;
                                info.getYearFlag =  this.euabs[i].getYearFlag==null?'':this.euabs[i].getYearFlag;
                                info.sumins =  this.euabs[i].sumins==null?'':this.euabs[i].sumins;
                                info.zbinstprem = this.euabs[i].zbinstprem==null?'':this.euabs[i].zbinstprem;
                            }    
                        }
                        let notExisRisk = true;
                        let exisMain = false;
                        for(let j = 0 ; j < this.convertToPolplnInfo.length; j++) {
                            if(this.convertToPolplnInfo[j].riskCode == baseAttachfor){
                                notExisRisk = false;
                                if(this.convertToPolplnInfo[j].statFund=='M'){
                                    exisMain = true;
                                }
                                break;
                            }
                        }
                        if(notExisRisk){
                            let main = this.convertToPolplnInfo[0];
                            let riskAtt = this.convertToPolplnInfo[1];
                            this.convertToPolplnInfo = [];
                            this.convertToPolplnInfo.push(main);
                            this.convertToPolplnInfo.push(info);
                            this.convertToPolplnInfo.push(riskAtt);  
                        }
                        if(exisMain && this.convertToPolplnInfo.length == 3){
                            this.convertToPolplnInfo.splice(1,1);
                        }
                    }else{
                        if(this.convertToPolplnInfo.length == 3){
                            this.convertToPolplnInfo.splice(1,1);
                        }
                    }
               }    
            },
            convertToPolplnFun() {
                let currentObj;
                for(let i = 0; i < this.convertToPolplnInfo.length; i++) {
                    if(this.convertToPolplnInfo[i].riskCode == this.baseInfo.riskCode) {
                        currentObj = this.convertToPolplnInfo[i];
                        if(currentObj.insuYear == '' || currentObj.insuYearFlag == ''){
                            this.$message.error("保障期不能为空！");
                            return false;
                        }
                        if(currentObj.payendyear == '' || currentObj.payendyearflag == ''){
                            this.$message.error("缴费期不能为空！");
                            return false;
                        }
                        break;
                    }
                }
                this.baseInfo.appntBirthday = this.insureDataForm.euad1.cltdob;
                this.baseInfo.insuredBirthday = this.insureDataForm.euad2.cltdob;
                this.baseInfo.pageFirstPayfee = this.euaa.firstpremTotal;
                this.baseInfo.appldate = this.euaa.appldate;
                let para = {
                    "head" : {
                        "transactionNo" : "06bba8edb0838a4acf39c700ed2c0a6c",
                        "visitCode": "zihe",
                        "timeStamp" : "2019-12-07 17:03:50",
                        "requestFrom" : "XYT"
                    },
                    "body" : {
                        "baseInfo" : this.baseInfo,
                        "planList": this.convertToPolplnInfo
                    }
                }
                convertToPolpln(para).then(res =>{
                    if(res.resultCode == 0 && res.data){
                        if(res.data.polpln == 'XXXXXX') {
                            this.$message.error("没有匹配险种代码，请重新选择");
                            this.polplnDialogVisible = false;
                            this.xzDialogVisible = false;
                        } else {
                            this.selectRow.polpln = res.data.polpln;
                            this.selectRow.riskCode = this.baseInfo.riskCode;
                            this.selectRow.getYearFlag = currentObj.getYearFlag;
                            this.selectRow.getYear = currentObj.getYear;
                            this.selectRow.sumins = currentObj.sumins;
                            this.selectRow.zbinstprem = currentObj.zbinstprem;
                            if(this.convertRow.sinsureown == '2'){
                                this.selectRow.clntnum = this.euad1.clntnum;
                                this.selectRow.asName = this.euad1.surname;
                                this.selectRow.asAge = this.euad1.anbAtCcd2;
                                this.selectRow.asSex = this.euad1.cltsex;
                                this.selectRow.asId = this.euad1.secuityno;
                            }else if(this.convertRow.sinsureown == '1'){
                                this.selectRow.clntnum = this.euad2.clntnum;
                                this.selectRow.asName = this.euad2.surname;
                                this.selectRow.asAge = this.euad2.anbAtCcd2;
                                this.selectRow.asSex = this.euad2.cltsex;
                                this.selectRow.asId = this.euad2.secuityno;
                            }
                            this.polplnDialogVisible = false;
                            this.xzDialogVisible = false;
                            this.checkPolplnInvest(this.selectIndex, this.selectRow);
                        }
                    }
                }).catch(err =>{
                    console.log(err);
                })
            },
            isNumber(value) {
                let num = Number.parseInt(value);
                if(Number.isInteger(num) ) {
                	if(this.insureDataForm.euaa.billfreq =='00'){
                		if(num >= 0 && num < 999){
                			return num;
                		}
                	} else{
                		if(num > 0 && num < 999){
                			return num;
                		}
                	}
                } 
                this.$message.error("必须为三位的整数")
                return "";
            },
            checkSumins(row){
                if(row.sumins == null){
                    row.sumins = 0;
                }
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let para = {
                    euabList: this.euabs,
                    rowNum: row.rowNum,
                    sumins: row.sumins
                };
                checkSumins(para).then(res =>{
                    if(res.resultCode == constant.SUCCESS){
                        let data = res.data;
                        if(data != null){
                            if(data.euabpkyForm_sumins != undefined){
                                row.sumins = data.euabpkyForm_sumins;
                            }
                            if(data.info != undefined){
                                this.$message({
                                    message: data.info,
                                    type: 'error'
                                });
                            }
                        }
                    }
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })
            },
            checkZbinstprem(row){
                if(row.zbinstprem == null){
                    row.zbinstprem = 0;
                }
                this.$store.dispatch('loading/CHNAGE_SUBLOADING',true);
                let para = {
                    euabList: this.euabs,
                    billfreq: this.euaa.billfreq,
                    rowNum: row.rowNum,
                    strZbinstprem: row.zbinstprem
                };
                checkZbinstprem(para).then(res =>{
                    if(res.resultCode == constant.SUCCESS){
                        let data = res.data;
                        if(data != null){
                            if(data.euabpkyForm_sumins != undefined){
                                row.sumins = data.euabpkyForm_sumins;
                            }
                             if(data.euabpkyForm_instprem != undefined){
                                row.instprem = data.euabpkyForm_instprem;
                            }
                            if(data.info != undefined){
                                this.$message({
                                    message: data.info,
                                    type: 'error'
                                });
                            }
                        }
                    }
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                }).catch(err =>{
                    console.log(err);
                    this.$store.dispatch('loading/CHNAGE_SUBLOADING',false);
                })
            }
        },
        watch:{
        }
    }
</script>
<style>
	.btn-cancel {
	  float: right;
	  margin-left: 10px;
	}
</style>
<style lang="less" scoped>
.baseInfoPage{
    // 操作删除图标
         .operationIcon{
            border:1px solid #e5e5e5;
            box-shadow:0 0 3px #f9f9f9;
            border-radius: 50%;
            cursor: pointer;
            color: #68a3fc;
            display: inline-block;
            width: 22px; 
            height: 22px; 
        }
    .premium{
         border-top: 1px solid #e1e1e1;
          background-color: #f5f5f5;
          padding: 10px 20px 0;
    }
    .common-box{
        padding-bottom: 15px;
    }
    .common-lab{
        line-height:normal!important;
        text-align: right;
        .labelName{
            text-align: right;
        }
    }
    
}
</style>